import { Injectable, Injector } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from '../../../../../environments/environment';
import { RyBaseServiceService } from '../../../../common/RyBaseService.service';

@Injectable({
    providedIn: 'root'
})
export class DictDataService extends RyBaseServiceService{
    base = '/system/dict/data';
    constructor(private _injector: Injector,) {
        super(_injector);
        super.setBase(this.base);
    }

    /**
     * 获取列表
     */
    list(searchObj: any): Observable<any> {
        const params = {
            ...searchObj
        };
        const option = {
            params
        };
        return this._http.get<any>(environment.baseUrl + this.base + '/list', option);
    }



    /**
     * 通过key 获取字典值
     */
    getDictValue(dictKey: string): Observable<any> {
        return this._http.get<any>(environment.baseUrl + this.base +"/type/"+ dictKey, {});
    }
}
